//
//  CPYRadioRightTableViewCell.m
//  TTMusic
//
//  Created by chenpengyu on 16/4/2.
//  Copyright © 2016年 cpy. All rights reserved.
//

#import "CPYRadioRightTableViewCell.h"

@implementation CPYRadioRightTableViewCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.picImageViev = [[UIImageView alloc] init];
        
        self.titleLabel = [[UILabel alloc] init];
        
        self.listenCountLabel = [[UILabel alloc] init];
        
        self.lineView = [[UIView alloc] init];
        
        
        [self.contentView addSubview:_picImageViev];
        [self.contentView addSubview:_titleLabel];
        [self.contentView addSubview:_listenCountLabel];
        [self.contentView addSubview:_lineView];
        
        _titleLabel.textColor = FONTCOLORHEI;
        _listenCountLabel.textColor = FONTCOLORHUI;
        _listenCountLabel.font = [UIFont systemFontOfSize:12];
        _lineView.backgroundColor = COLOR(234, 234, 234);
        
        
    }
    return self;
}


-(void)layoutSubviews{
    [super layoutSubviews];
    _picImageViev.frame = CGRectMake(10, 10, 90, 90);
    _titleLabel.frame = CGRectMake(110, 25, 180, 30);
    _listenCountLabel.frame = CGRectMake(110, 60, 180, 20);
    _lineView.frame = CGRectMake(10 * FitWidth, self.bounds.size.height - 0.7, self.bounds.size.width - 20 * FitWidth, 0.7);
    
    [self updateFrame:_picImageViev];
    [self updateFrame:_titleLabel];
    [self updateFrame:_listenCountLabel];
}
- (void)updateFrame:(UIView *)view{
    
    CGRect rect = view.frame;
    view.frame = CGRectMake(rect.origin.x * FitWidth, rect.origin.y * FitWidth, rect.size.width * FitWidth, rect.size.height * FitWidth);
}
- (void)setDataDetailModel:(CPYRadioDataDetailModel *)dataDetailModel {
    _dataDetailModel = dataDetailModel;
    [_picImageViev sd_setImageWithURL:[NSURL URLWithString:dataDetailModel.large_pic_url]];
    _titleLabel.text = dataDetailModel.tag_name;
    _listenCountLabel.text = [NSString stringWithFormat:@"试听热度：%@" ,dataDetailModel.listen_count];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
